#ifndef _SELECTEDSTATE_H_
#define _SELECTEDSTATE_H_

#include "model.h"

class SelectedState {
  private:
    Model *m;

  public:
    int texid = 0;
    // parameter for translate/scale/rotate
    float translate[3] = {0, 0, 0};
    float scale[3] = {1, 1, 1};
    float rotate[3] = {0, 1, 0};
    float angle = 0;

    // parameter for material
    float ambient[4] = {1.0, 1.0, 1.0, 1.0};
    float diffuse[4] = {1.0, 1.0, 1.0, 1.0};
    float specular[4] = {1.0, 1.0, 1.0, 1.0};
    float shininess[1] = {0.5f};

    SelectedState(Model *m) {
        m->getTranslate(translate[0], translate[1], translate[2]);
        m->getScale(scale[0], scale[1], scale[2]);
        m->getRotate(angle, rotate[0], rotate[1], rotate[2]);

        m->getAmbient(ambient[0], ambient[1], ambient[2], ambient[3]);
        m->getDiffuse(diffuse[0], diffuse[1], diffuse[2], diffuse[3]);
        m->getSpecular(specular[0], specular[1], specular[2], specular[3]);
        m->getShininess(shininess[0]);

        texid = int(m->getTexture());

        this->m = m;
    }

    void modify() {
        m->setTranslate(translate[0], translate[1], translate[2]);
        m->setScale(scale[0], scale[1], scale[2]);
        m->setRotate(angle, rotate[0], rotate[1], rotate[2]);

        m->setAmbient(ambient[0], ambient[1], ambient[2], ambient[3]);
        m->setDiffuse(diffuse[0], diffuse[1], diffuse[2], diffuse[3]);
        m->setSpecular(specular[0], specular[1], specular[2], specular[3]);
        m->setShininess(shininess[0]);

        m->setTexture(texid);
    }
};

#endif
